package com.behelpful.common.data.typehandler;

import com.behelpful.common.core.utils.ICollUtil;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedJdbcTypes;
import org.apache.ibatis.type.MappedTypes;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * 自定义字符串Set集合转字符串
 *
 * @author Alay
 * @date 2021-09-03 15:00
 * @project yshop
 */
@Component
@MappedJdbcTypes(value = JdbcType.VARCHAR)
@MappedTypes(value = {Set.class})
public class Str2SetTypeHandler extends Str2CollectionTypeHandler<Set<String>> {

    @Override
    public Set<String> toCollection(String... array) {
        return ICollUtil.asSet(array);
    }
}
